<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include::head"></head>
<body>
<div class="layui-anim layui-anim-scale layui-fluid">
    <div class="layui-row layui-col-space15 table-search">
        <div class="layui-col-md12">
            <form class="layui-form">

                <div class="layui-form-item">
                    <label class="layui-form-label">登录账号</label>
                    <div class="layui-input-block">
                        <input type="text" disabled="" name="loginAccount" th:value="${user.loginAccount}" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">登录密码</label>
                    <div class="layui-input-inline">
                        <input type="password" disabled="" th:value="${user.password}" autocomplete="off" class="layui-input">
                    </div>
                    <button type="button" class="layui-btn layui-btn-primary layui-icon layui-icon-password"  id="update-password">更改密码</button>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-inline">
                        <img class="jelly-homepage-pad-img" style="width: 50px;height: 50px;" th:src="${user.img}" />
                        <button type="button" class="layui-btn layui-btn-primary" id="upload-img"><i class="layui-icon"></i>更改头像</button>
                    </div>
                    <div class="layui-form-mid layui-word-aux">头像的尺寸限定150x150px,大小在50kb以内</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="jelly-identification">*</i>昵称</label>
                    <div class="layui-input-block">
                        <input type="text" name="nickname" th:value="${user.nickname}" autocomplete="off" lay-verify="required" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="jelly-identification">*</i>真实姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" th:value="${user.userName}" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="jelly-identification">*</i>手机号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mobile" th:value="${user.mobile}" lay-verify="required|mobile" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <th:block th:each="value: ${diy['sex_type']}">
                            <input th:if="${value.dictionaryRoute==user.sex}" type="radio" name="sex" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}"  checked  >
                            <input th:if="${value.dictionaryRoute!=user.sex}" type="radio" name="sex" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}">
                        </th:block>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">年龄</label>
                    <div class="layui-input-block">
                        <input type="text" name="age" th:value="${user.age}" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">QQ</label>
                        <div class="layui-input-inline">
                            <input type="text" name="qq" th:value="${user.qq}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">微信</label>
                        <div class="layui-input-inline">
                            <input type="text" name="weixin" th:value="${user.weixin}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-block">
                        <input type="text" name="email" th:value="${user.email}" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">地址</label>
                    <div class="layui-input-block">
                        <input type="text" name="ress" th:value="${user.ress}" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">个性签名</label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea"  name="description"  th:utext="${user.description}" ></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>

<div th:include="include::onload"></div>
<script  th:inline="javascript">
    layui.config({
        base: '/js/layer/module/'//模块存放的目录
    }).use(['form'], function(){
        var form = layui.form;

        $('#upload-img').click(function () {
            Layer.openDialog("更改头像","/share/user-infor/user-upload",'90%','90%');
        });

        $('#update-password').click(function () {
            Layer.openDialog("更改密码","/share/user-infor/password",'50%','43%');
        });

        //监听提交
        form.on('submit(demo1)', function(data){
            $.achieve.postRefresh("/share/user-infor/update",data.field);
            return false;
        });
    });
</script>
</body>
</html>